package java68_9;

import org.apache.log4j.*;

public class TeacherTest {
    public static final Logger Log = Logger.getLogger(TeacherTest.class);

    public static void main(String[] args) {
        if(Log.isDebugEnabled())
            Log.debug("现在开始测试异常!");


        Log.info("开始创建老师对象");
        Teacher t = new Teacher();
        t.setName("老刘");
        try {
            Log.info("给老师设置了年龄为14");
            t.setAge(10);
            //System.out.println(t);
            Log.info(t);
        } catch (Exception e) {
            //e.printStackTrace();
            Log.error("设置年龄错误",e);
        }


//        try {
//            t.setAge(14);
//            System.out.println(t);
//        }catch (Exception e){
//            System.out.println("年龄设置错误");
//            e.printStackTrace();
//        }
    }
}
